﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace CJJCH.Web.Manage
{
    public partial class NewsDetails : PowerBase
    {
        CJJCH.BLL.T_NET_News bll_news = new CJJCH.BLL.T_NET_News();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                InitRequest();
                ShowNews();
            }
        }

        private void InitRequest()
        {
            if (!string.IsNullOrEmpty(Request.QueryString["ID"].ToString())&&LTP.Common.CheckInput.CheckGUID(Request.QueryString["ID"].ToString()))
            {
                ViewState["ID"] = Request.QueryString["ID"].ToString();
            }
            else
            {
                LTP.Common.WindowClass.WindowBack("操作错误！");
            }
        }

        private void ShowNews()
        {
            CJJCH.Model.T_NET_News model = new CJJCH.Model.T_NET_News();
            model = bll_news.GetNewsModel(new Guid(ViewState["ID"].ToString()));
            if (model != null)
            {
                this.lblTitle.Text = model.DataTitle;
                this.lblAuthor.Text = model.DataAuthor;
                this.lblSource.Text = model.DataSource;
                if (model.MenuSecond.HaveChild)
                {
                    this.lblNewsType.Text = model.MenuThird.MenuName;
                }
                else
                {
                    this.trType.Style.Add("display","none");
                }
                this.lblIsHot.Text = model.IsHot.ToString().ToLower() == "true" ? "是" : "否";
                this.lblIsTop.Text = model.IsTop.ToString().ToLower() == "true" ? "是" : "否";
                this.lblPlusDate.Text = model.PlusDate.ToString("yyyy/MM/dd");
                this.lblOrderNum.Text = model.OrderNum.ToString();
                this.lblNote.Text =Server.HtmlDecode(model.DataNote);
            }
            else
            {
                LTP.Common.WindowClass.WindowBack("操作错误！");
            }
        }
    }
}